# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>

pkgname=cage
pkgver=0.1.5
pkgrel=2
pkgdesc="A kiosk compositor for Wayland"
arch=(loong64 x86_64)
url="https://www.hjdskes.nl/projects/cage/"
license=(MIT)
depends=(glibc wayland wlroots0.16)
makedepends=(git libxkbcommon meson pixman scdoc wayland-protocols
xorg-server-xwayland)
optdepends=(
  'polkit: System privilege control. Required if not using seatd service'
  'xorg-server-xwayland: X11 support'
)
source=("${pkgname}::git+https://github.com/Hjdskes/${pkgname}.git#tag=v${pkgver}?signed")
install=cage.install
sha512sums=('SKIP')
validpgpkeys=(
    '13B6A35E9FD677D02CD68DBE37C445296EBC43B1' # Jente Hidskes <dev@hjdskes.nl>
    '34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48' # Simon Ser <contact@emersion.fr>
)

build() {
  export PKG_CONFIG_PATH='/usr/lib/wlroots0.16/pkgconfig'
  arch-meson -Dxwayland=true build "$pkgname"
  ninja -C build
}

check() {
  ninja -C build test
}

package() {
  depends+=(libwlroots.so=11 libxkbcommon.so libpixman-1.so)

  DESTDIR="${pkgdir}" meson install -C build
  install -vDm 644 "$pkgname/README.md" -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 "$pkgname/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
